<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />









  <meta name="baidu-site-verification" content="Q7ugSRSO7V" />







  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="database,auth," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="insert 正常插入： &amp;gt; db.user.insert(&amp;#123;x:1,y:2,z:3&amp;#125;)WriteResult(&amp;#123; &quot;nInserted&quot; : 1 &amp;#125;)  循环插入 &amp;gt; for(var i=1;i&amp;lt;100;i++) db.user.insert(&amp;#123;x:i, y:i*10, z:i*100&amp;#125;)WriteResult(&amp;#1">
<meta name="keywords" content="database,auth">
<meta property="og:type" content="article">
<meta property="og:title" content="CRUD操作">
<meta property="og:url" content="http://yoursite.com/mongodb/CRUD/index.html">
<meta property="og:site_name" content="chimps">
<meta property="og:description" content="insert 正常插入： &amp;gt; db.user.insert(&amp;#123;x:1,y:2,z:3&amp;#125;)WriteResult(&amp;#123; &quot;nInserted&quot; : 1 &amp;#125;)  循环插入 &amp;gt; for(var i=1;i&amp;lt;100;i++) db.user.insert(&amp;#123;x:i, y:i*10, z:i*100&amp;#125;)WriteResult(&amp;#1">
<meta property="og:updated_time" content="2017-06-07T05:33:35.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="CRUD操作">
<meta name="twitter:description" content="insert 正常插入： &amp;gt; db.user.insert(&amp;#123;x:1,y:2,z:3&amp;#125;)WriteResult(&amp;#123; &quot;nInserted&quot; : 1 &amp;#125;)  循环插入 &amp;gt; for(var i=1;i&amp;lt;100;i++) db.user.insert(&amp;#123;x:i, y:i*10, z:i*100&amp;#125;)WriteResult(&amp;#1">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"hide","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":30},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/mongodb/CRUD/"/>





  <title> CRUD操作 | chimps </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?dcb994042608bdb310eff950ba755ff1";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">chimps</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/mongodb/CRUD/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="chimps">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://sfault-avatar.b0.upaiyun.com/416/326/4163260007-58a1621e63a68_huge256">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="chimps">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                CRUD操作
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-04-23T21:42:26+08:00">
                2017-04-23
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/mongodb/" itemprop="url" rel="index">
                    <span itemprop="name">mongodb</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a class="cloud-tie-join-count" href="/mongodb/CRUD/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count join-count" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="insert"><a href="#insert" class="headerlink" title="insert"></a>insert</h1><ul>
<li><p>正常插入：</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.insert(&#123;<span class="attr">x</span>:<span class="number">1</span>,<span class="attr">y</span>:<span class="number">2</span>,<span class="attr">z</span>:<span class="number">3</span>&#125;)</div><div class="line">WriteResult(&#123; <span class="string">"nInserted"</span> : <span class="number">1</span> &#125;)</div></pre></td></tr></table></figure>
</li>
<li><p>循环插入</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; <span class="keyword">for</span>(<span class="keyword">var</span> i=<span class="number">1</span>;i&lt;<span class="number">100</span>;i++) db.user.insert(&#123;<span class="attr">x</span>:i, <span class="attr">y</span>:i*<span class="number">10</span>, <span class="attr">z</span>:i*<span class="number">100</span>&#125;)</div><div class="line">WriteResult(&#123; <span class="string">"nInserted"</span> : <span class="number">1</span> &#125;)</div></pre></td></tr></table></figure>
</li>
</ul>
<h1 id="update"><a href="#update" class="headerlink" title="update"></a>update</h1><ul>
<li><p>整个更新</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.find()</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d844bae387d0c1e8d870"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">2</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d84ebae387d0c1e8d871"</span>), <span class="string">"x"</span> : <span class="number">2</span>, <span class="string">"y"</span> : <span class="number">3</span> &#125;</div><div class="line">&gt; db.user.update(&#123;<span class="attr">x</span>:<span class="number">1</span>&#125;,&#123;<span class="attr">x</span>:<span class="number">999</span>&#125;)</div><div class="line">WriteResult(&#123; <span class="string">"nMatched"</span> : <span class="number">1</span>, <span class="string">"nUpserted"</span> : <span class="number">0</span>, <span class="string">"nModified"</span> : <span class="number">1</span> &#125;)</div><div class="line">&gt; db.user.find()</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d844bae387d0c1e8d870"</span>), <span class="string">"x"</span> : <span class="number">999</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d84ebae387d0c1e8d871"</span>), <span class="string">"x"</span> : <span class="number">2</span>, <span class="string">"y"</span> : <span class="number">3</span> &#125;</div></pre></td></tr></table></figure>
</li>
<li><p>部分更新<br>使用$set操作符</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.find()</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d844bae387d0c1e8d870"</span>), <span class="string">"x"</span> : <span class="number">999</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d84ebae387d0c1e8d871"</span>), <span class="string">"x"</span> : <span class="number">2</span>, <span class="string">"y"</span> : <span class="number">3</span> &#125;</div><div class="line">&gt; db.user.update(&#123;<span class="attr">x</span>:<span class="number">2</span>&#125;,&#123;<span class="attr">$set</span>:&#123;<span class="attr">x</span>:<span class="number">999</span>&#125;&#125;)</div><div class="line">WriteResult(&#123; <span class="string">"nMatched"</span> : <span class="number">1</span>, <span class="string">"nUpserted"</span> : <span class="number">0</span>, <span class="string">"nModified"</span> : <span class="number">1</span> &#125;)</div><div class="line">&gt; db.user.find()</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d844bae387d0c1e8d870"</span>), <span class="string">"x"</span> : <span class="number">999</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d84ebae387d0c1e8d871"</span>), <span class="string">"x"</span> : <span class="number">999</span>, <span class="string">"y"</span> : <span class="number">3</span> &#125;</div></pre></td></tr></table></figure>
</li>
<li><p>不存在则创建</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.find(&#123;<span class="attr">x</span>:<span class="number">1</span>&#125;)</div><div class="line">&gt; db.user.update(&#123;<span class="attr">x</span>:<span class="number">1</span>&#125;,&#123;<span class="attr">x</span>:<span class="number">2</span>&#125;,<span class="literal">true</span>)</div><div class="line">WriteResult(&#123;</div><div class="line">	<span class="string">"nMatched"</span> : <span class="number">0</span>,</div><div class="line">	<span class="string">"nUpserted"</span> : <span class="number">1</span>,</div><div class="line">	<span class="string">"nModified"</span> : <span class="number">0</span>,</div><div class="line">	<span class="string">"_id"</span> : ObjectId(<span class="string">"58d0da6e34123eac45d857ac"</span>)</div><div class="line">&#125;)</div><div class="line">&gt; db.user.find()</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d844bae387d0c1e8d870"</span>), <span class="string">"x"</span> : <span class="number">999</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d84ebae387d0c1e8d871"</span>), <span class="string">"x"</span> : <span class="number">999</span>, <span class="string">"y"</span> : <span class="number">3</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0da6e34123eac45d857ac"</span>), <span class="string">"x"</span> : <span class="number">2</span> &#125;</div></pre></td></tr></table></figure>
</li>
<li><p>更新多条<br>mongodb默认是更新一条，据说是为了防止一时大意，<br>而且更新多条不允许更新整个，只能使用$set关键字</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.find()</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0dde9bae387d0c1e8d873"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">2</span>, <span class="string">"z"</span> : <span class="number">1</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0ddeabae387d0c1e8d874"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">1</span>, <span class="string">"z"</span> : <span class="number">1</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0ddebbae387d0c1e8d875"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">1</span>, <span class="string">"z"</span> : <span class="number">1</span> &#125;</div><div class="line">&gt; db.user.update(&#123;<span class="attr">x</span>:<span class="number">1</span>&#125;,&#123;<span class="attr">$set</span>:&#123;<span class="attr">y</span>:<span class="number">2</span>&#125;&#125;,<span class="literal">false</span>,<span class="literal">true</span>)</div><div class="line">WriteResult(&#123; <span class="string">"nMatched"</span> : <span class="number">3</span>, <span class="string">"nUpserted"</span> : <span class="number">0</span>, <span class="string">"nModified"</span> : <span class="number">2</span> &#125;)</div><div class="line">&gt; db.user.find()</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0dde9bae387d0c1e8d873"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">2</span>, <span class="string">"z"</span> : <span class="number">1</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0ddeabae387d0c1e8d874"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">2</span>, <span class="string">"z"</span> : <span class="number">1</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0ddebbae387d0c1e8d875"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">2</span>, <span class="string">"z"</span> : <span class="number">1</span> &#125;</div></pre></td></tr></table></figure>
</li>
</ul>
<h1 id="remove"><a href="#remove" class="headerlink" title="remove"></a>remove</h1><ul>
<li><p>删除某个collection所有内容</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.remove(&#123;&#125;)</div><div class="line">WriteResult(&#123; <span class="string">"nRemoved"</span> : <span class="number">102</span> &#125;)</div></pre></td></tr></table></figure>
</li>
<li><p>删除某个</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.remove(&#123;<span class="attr">x</span>:<span class="number">3</span>&#125;)</div><div class="line">WriteResult(&#123; <span class="string">"nRemoved"</span> : <span class="number">1</span> &#125;)</div></pre></td></tr></table></figure>
</li>
</ul>
<h1 id="find"><a href="#find" class="headerlink" title="find"></a>find</h1><ul>
<li><p>查找所有</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.find()</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0cebcbae387d0c1e8d80a"</span>), <span class="string">"username"</span> : <span class="string">"zhangsan"</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d36abae387d0c1e8d80b"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">2</span>, <span class="string">"z"</span> : <span class="number">3</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d37dbae387d0c1e8d80c"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">2</span>, <span class="string">"z"</span> : <span class="number">3</span> &#125;</div></pre></td></tr></table></figure>
</li>
<li><p>有条件查找</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.find(&#123;<span class="attr">x</span>:<span class="number">1</span>&#125;)</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d36abae387d0c1e8d80b"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">2</span>, <span class="string">"z"</span> : <span class="number">3</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d37dbae387d0c1e8d80c"</span>), <span class="string">"x"</span> : <span class="number">1</span>, <span class="string">"y"</span> : <span class="number">2</span>, <span class="string">"z"</span> : <span class="number">3</span> &#125;</div></pre></td></tr></table></figure>
</li>
<li><p>查找总数目</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.find().count()</div><div class="line"><span class="number">102</span></div></pre></td></tr></table></figure>
</li>
<li><p>分页,排序</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.find().skip(<span class="number">5</span>).limit(<span class="number">3</span>).sort(&#123;<span class="attr">x</span>:<span class="number">1</span>&#125;)</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d453bae387d0c1e8d80f"</span>), <span class="string">"x"</span> : <span class="number">3</span>, <span class="string">"y"</span> : <span class="number">30</span>, <span class="string">"z"</span> : <span class="number">300</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d453bae387d0c1e8d810"</span>), <span class="string">"x"</span> : <span class="number">4</span>, <span class="string">"y"</span> : <span class="number">40</span>, <span class="string">"z"</span> : <span class="number">400</span> &#125;</div><div class="line">&#123; <span class="string">"_id"</span> : ObjectId(<span class="string">"58d0d453bae387d0c1e8d811"</span>), <span class="string">"x"</span> : <span class="number">5</span>, <span class="string">"y"</span> : <span class="number">50</span>, <span class="string">"z"</span> : <span class="number">500</span> &#125;</div></pre></td></tr></table></figure>
</li>
</ul>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/database/" rel="tag"># database</a>
          
            <a href="/tags/auth/" rel="tag"># auth</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/mongodb/auth/" rel="next" title="auth认证">
                <i class="fa fa-chevron-left"></i> auth认证
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/golang/函数，结构与接口/" rel="prev" title="函数，结构与接口">
                函数，结构与接口 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="https://sfault-avatar.b0.upaiyun.com/416/326/4163260007-58a1621e63a68_huge256"
               alt="chimps" />
          <p class="site-author-name" itemprop="name">chimps</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">59</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">12</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">19</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#insert"><span class="nav-number">1.</span> <span class="nav-text">insert</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#update"><span class="nav-number">2.</span> <span class="nav-text">update</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#remove"><span class="nav-number">3.</span> <span class="nav-text">remove</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#find"><span class="nav-number">4.</span> <span class="nav-text">find</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">chimps</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  








  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  


  




	





  
    
    <script>
      var cloudTieConfig = {
        url: document.location.href, 
        sourceId: "",
        productKey: "48bb30d8783d4b38ba0c95e0283238ca",
        target: "cloud-tie-wrapper"
      };
    </script>
    <script src="https://img1.ws.126.net/f2e/tie/yun/sdk/loader.js"></script>
  










  





  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  

  

</body>
</html>
